<template>
	<view>
		<view @click="go(item)" v-for="(item,index) in list" :key="index" class="list">
			<view class="u-flex u-row-between u-border-bottom u-padding-bottom-20">
				<view v-if="isTechnician">联系人:{{item.contact_name}}   </view>
				<view v-else>技师:{{item.technician_info.nickname}}   </view>
				<view>{{$Status(Number( item.status),item.is_pay_type )}} </view>
			</view>
			<view class="u-flex u-margin-top-20 u-margin-bottom-20">
				<u-image :src="$Url( item.project_info.images[0]) " width="158" height="140"></u-image>
				<view class="u-margin-left-20 u-flex-1">
					<view class=" u-flex u-row-between">
						<view class="u-font-weight">{{item.project_info.name}}</view>
						<view style="color: #00C08D;">￥{{item.need_price}}</view>
					</view>
					<view style="margin: 10rpx 0;color: #b5b5b5;">
						下单时间：{{item.createtime}}
					</view>
					<view style="color: #b5b5b5;">
						预约时间：{{item.appointment_start_time}}
					</view>
				</view>

			</view>

			<view class="u-flex u-flex-end u-border-top u-padding-top-20">
				
				
				<u-button v-if="isTechnician==0 && item.is_pay_type==0" @click.stop="pay(item)" type="error"
					shape="circle" size="mini" >我要支付</u-button>
				
				
				<u-button  v-if="isTechnician==0 && item.status==0 && item.is_pay_type==1" @click.stop="controls(item)" type="info"
					shape="circle" size="mini"   @click="close(item)">取消订单</u-button>
				
				<u-button v-if="isTechnician==1 && item.status==0" @click.stop="controls(item)" type="error"
					shape="circle" size="mini" >拒绝接单</u-button>
				
				<u-button v-if="isTechnician==0 && item.status==5" @click.stop="evaluate(item)" :type="item.is_comments? 'info':'success'"
					shape="circle" size="mini" >{{item.is_comments?'已评价':'评价'}}  </u-button>
				<u-button class="u-margin-left-20" @click.stop="go(item)" type="success" shape="circle" size="mini" >查看订单</u-button>
			</view>

		</view>
	</view>
</template>

<script>
	// 状态:0=待接单,1=已接单,2=待服务,3=已到达,4=进行中,5=已完成,6=已取消,7=已拒绝
	export default {
		props: {
			list: {
				type: Array
			},
			isTechnician: {
				type: Number
			}
		},

		data() {
			return {

			}
		},
		methods: {
			evaluate(item) {
				if(item.is_comments)return
		
				uni.navigateTo({
					url: '/pages/evaluate/index?id=' + item.trade_no
				})
			},
			go(item) {
				uni.navigateTo({
					url: '/pages/book/detail?id=' + item.trade_no + "&isTechnician=" + this.isTechnician
				})
			},
			controls(item){
				this.$emit("controls",item)
			},
			pay(item){
				this.$emit("pay",item)
			},
			close(item){
				this.$emit("close",item)
			}
		}
	}
</script>

<style>
	.list {
		background: #fff;
		width: 700rpx;
		margin: 20rpx auto;
		padding: 20rpx;
		border-radius: 20rpx;
	}
</style>
